home *** CD-ROM | disk | FTP | other *** search
- Path: EU.net!sun4nl!xs4all!marketgraph!rvg
- From: rvg@marketgraph.xs4all.nl (Ruud van Gaal)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: C Code prob
- Message-ID: <2232lai60.alamito@marketgraph.xs4all.nl>
- Date: Tue, 9 Jan 96 11:50:34 CET
- References: <Pine.SOL.3.91-941213.960108214431.23338A-100000@altair.dur.ac.uk>
- Reply-To: rvg@marketgraph.xs4all.nl
- X-Newsreader: Alamito Mail and News Manager (V2.0.4 for Waffle) registered to MARKETGRAPH VISUAL AUTOMATION
-
- In <Pine.SOL.3.91-941213.960108214431.23338A-100000@altair.dur.ac.uk> Nick
- Pratt <N.B.Pratt@durham.ac.uk> wrote:
-
- >Im trying to code a get around for a program originally coded in MS-DOS
- >Turbo C using cprint(). Im tryint to port this prog to my Amiga using the
- >curses.lib. However, curses.lib does not print \r control codes, so I
- >tried the following:
- >void cprintf(const char *fmt, ... )
- >{ char c, newfmt[4096];
- > int i=0, j=0, len;
- > va_list ap;
- > va_start(ap,fmt);
- > len = strlen(fmt);
- > while( len > (j-1) )
- > {
- > c = fmt[j++];
- > if( c == '\r' ) /* Discard any \r's */
- > continue;
- > newfmt[i++] = c; /* Otherwise, copy the char to the new array
- */
- > }
- > /* printw() is out of curses.lib, and doesnt convert \r */
- > printw(newfmt, ?????? );
- > /* What I now need to do is call printw() with the format string of
- > newfmt, and also with all the arguments supplied to cprintf();
- > Whats the best way to do this?
- > */
-
- If possible, you could declare a local buffer (char buf[100] or some size),
- and use vsprintf() to format the string inside cprint() and then pass the
- converted string to printw().
-
- > va_end(ap);
- > return;
- >}
-
- --
- Ruud van Gaal
- MarketGraph Visual Automation
- E-Mail: rvg@marketgraph.xs4all.nl
- "...Works fascinates me. I could sit and watch it for hours..."
-
-